package com.sskj.gocoin.m.bean.bean;

import android.text.TextUtils;


import com.github.tifezh.kchartlib.chart.entity.IKLine;
import com.github.tifezh.kchartlib.chart.entity.IMinuteLine;

import java.util.Date;

/**
 * Created by Administrator on 2018/4/3.
 */

public class Stock implements IKLine, IMinuteLine {
    public Stock(String code, String name, float openingPrice, String closingPrice, float highestPrice, float lowestPrice, double volume, String date, String time, long timestamp) {
        this.code = code;
        this.name = name;
        this.openingPrice = openingPrice;
        this.closingPrice = closingPrice;
        this.highestPrice = highestPrice;
        this.lowestPrice = lowestPrice;
        this.volume = volume;
        this.date = date;
        this.time = time;
        this.timestamp = timestamp;
    }

    public Stock() {
    }

    /**
     * id : 3212141
     * period : null
     * code : eth_usdt
     * volume : 46.0054
     * openingPrice : 399.7658
     * closingPrice : 400.4279
     * highestPrice : 401.0494
     * lowestPrice : 399.7658
     * date : 1523289600000
     * time : 13:43:00
     * createTime : null
     * status : 0
     * timestamp : 1523339027000
     */


    private int id;
    private String pid;
    private String code;
    private String name;
    private float openingPrice;
    private String closingPrice;
    private float highestPrice;
    private float lowestPrice;
    private double volume;
    private String date;
    private String time;
    private long timestamp;
    private String period;
    private String createTime;
    private int status;
    //交易币
    private String dateTime;

    public float MA5Price;

    public float MA10Price;

    public float MA20Price;

    public float dea;

    public float dif;

    public float macd;

    public float k;

    public float d;

    public float j;

    public float rsi1;

    public float rsi2;

    public float rsi3;

    public float up;

    public float mb;

    public float dn;

    public float MA5Volume;

    public float MA10Volume;

    public String getDateTime() {
        return dateTime;
    }

    public void setDateTime(String dateTime) {
        this.dateTime = dateTime;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getPeriod() {
        return period;
    }

    public void setPeriod(String period) {
        this.period = period;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    @Override
    public float getAvgPrice() {
        return lowestPrice;
    }

    @Override
    public float getPrice() {
        return Float.parseFloat(getClosingPrice());
    }

    Date minutedate = new Date();

    @Override
    public Date getMinuteDate() {
        String[] split = time.split(":");
        minutedate.setHours(Integer.parseInt(split[0]));
        minutedate.setMinutes(Integer.parseInt(split[1]));
        return minutedate;
    }

    public float getVolume() {
        return (float) volume;
    }

    public void setVolume(double volume) {
        this.volume = volume;
    }

    public float getOpeningPrice() {
        return openingPrice;
    }

    public void setOpeningPrice(float openingPrice) {
        this.openingPrice = openingPrice;
    }

    public String getClosingPrice() {
        return closingPrice;
    }

    public void setClosingPrice(String closingPrice) {
        this.closingPrice = closingPrice;
    }

    public float getHighestPrice() {
        return highestPrice;
    }

    public void setHighestPrice(float highestPrice) {
        this.highestPrice = highestPrice;
    }

    public float getLowestPrice() {
        return lowestPrice;
    }

    public void setLowestPrice(float lowestPrice) {
        this.lowestPrice = lowestPrice;
    }

    public void setDate(String date) {
        this.date = date;
    }

    public String getDate() {
        return date;
    }

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }


    private Float parse(String s) {
        return Float.valueOf(s);
    }

    @Override
    public float getMA5Volume() {
        return MA5Volume;
    }

    @Override
    public void setMA5Volume(float v) {

    }

    @Override
    public float getMA10Volume() {
        return MA10Volume;
    }

    @Override
    public void setMA10Volume(float v) {

    }

    @Override
    public float getOpenPrice() {
        return openingPrice;
    }

    @Override
    public float getHighPrice() {
        return highestPrice;
    }  // 最高价

    @Override
    public float getLowPrice() {
        return lowestPrice;
    }  // 最低价

    @Override
    public float getClosePrice() {
        return Float.parseFloat(closingPrice);
    }

    @Override
    public void setClosePrice(float closePrice) {
        this.closingPrice = closePrice + "";
    }

    @Override
    public float getMA5Price() {
        return MA5Price;
    }

    @Override
    public void setMA5Price(float v) {

    }

    @Override
    public float getMA10Price() {
        return MA10Price;
    }

    @Override
    public void setMA10Price(float v) {

    }

    @Override
    public float getMA20Price() {
        return MA20Price;
    }

    @Override
    public void setMA20Price(float v) {

    }

    @Override
    public long getDatetime() {
        return TextUtils.isEmpty(name) ? timestamp : timestamp * 1000;
    }


    @Override
    public float getDea() {
        return dea;
    }

    @Override
    public void setDea(float v) {

    }

    @Override
    public float getDif() {
        return dif;
    }

    @Override
    public void setDif(float v) {

    }

    @Override
    public float getMacd() {
        return macd;
    }

    @Override
    public void setMacd(float v) {

    }

    @Override
    public float getRsi1() {
        return rsi1;
    }

    @Override
    public float getRsi2() {
        return rsi2;
    }

    @Override
    public float getRsi3() {
        return rsi3;
    }

    @Override
    public void setRsi1(float v) {

    }

    @Override
    public void setRsi2(float v) {

    }

    @Override
    public void setRsi3(float v) {

    }

    @Override
    public float getUp() {
        return up;
    }

    @Override
    public void setUp(float v) {

    }

    @Override
    public float getMb() {
        return mb;
    }

    @Override
    public void setMb(float v) {

    }

    @Override
    public float getDn() {
        return dn;
    }

    @Override
    public void setDn(float v) {

    }

    @Override
    public float getK() {
        return k;
    }

    @Override
    public void setK(float v) {

    }

    @Override
    public float getD() {
        return d;
    }

    @Override
    public void setD(float v) {

    }

    @Override
    public float getJ() {
        return j;
    }

    @Override
    public void setJ(float v) {

    }
}
